home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
clipper
/
ks94an.zip
/
__ENCRYP.HDR
< prev
next >
Wrap
Text File
|
1994-04-25
|
3KB
|
87 lines
/******************************************************************************
The Klipper Library, for CA-Clipper 5.x
Copyright (c), 1994, Wallace Information Systems Engineering
FUNCTION:
_Encrypt( cEncStr, cKey ) --> cEncryptStr
PARAMETERS:
cEncStr : String to be encrypted.
cKey : Character String. Code to be used as encrypt key (optional)
SHORT:
Encrypt a string.
DESCRIPTION:
_Encrypt() employs a typical XOR encryption algorythm.
NOTE:
EXAMPLE:
t = _Encrypt('ABCDEFG') // t = bit-soup
t = _Encrypt(t) // t = ABCDEFG
-and with optional key-
t = _Encrypt('SESAME','CHEESE') // t = bit-soup simmered
// in 'CHEESE' sauce
? _Encrypt(t) // still bit-soup, would you like
// a napkin?
? _Encrypt(t,'CHEESE') // t = 'SESAME'
*****************************************************************
IMPORTANT: Due to the nature of an XOR encryption, especially
this implementation, if you specify a NULL string as the encryption
key, essentially NOTHING will happen. The encrypted result will be
exactly the same as the data being encrypted!
_Encrypt() does NOT check to see whether you have done this! (After all,
you know what you are doing, right?)
This will not endanger your data, because if you do this twice, (one
to encrypt and again to decrypt, the same string will be returned both
times).
You may wish to look into _Crypto(), which will give a unique encryption
even if you use a NULL string. It is also MUCH faster, as it is written
in "C", not Clipper.
Not also that an embedded NULL in an otherwise non-NULL key will not
cause this. This phenomenon occurs only when the entire key is a NULL
string. Tries ta be more smarts, wid dis. OK?
*****************************************************************
cKey is optional. If not specified, an internal password is used by default.
Remember also that concatenated values must be evaluated separately. If
you evaluate two fields like so:
_encode(user+system)
and
_encode(user)+_encode(system)
The two methods return different values. Why? Because when you evaluate
the two fields concatenated, the decryption key does not begin fresh with
the second value but continues decrypting the entire concatenanted value
until done.
Subservient functions _Encode() and _Decode() can be used interchangably
with _Encrypt(), since they all do the same thing. _Encode() and
_Decode() simply pass along to _Encrypt() what was passed to them. The
names Encode and Decode make things a little more easy to handle.
******************************************************************************/